<template>
  <ElTable :data="xxxxx">
    <ElTableColumn label="sssss" prop="name"></ElTableColumn>
    <ElTableColumn label="ss" prop="date"></ElTableColumn>
    <ElTableColumn label="sssssss" prop="address"></ElTableColumn>
  </ElTable>
  <ElFrom>
    <ElFormItem label="姓名">
      <ElInput v-model="yyyy.name"></ElInput>
    </ElFormItem>
    <ElFormItem label="年龄">
      <ElInputNumber v-model="yyyy.age" placeholder=""></ElInputNumber>
    </ElFormItem>
    <ElFormItem>
      <ElButton type="primary" @click="go2">提交 </ElButton>
    </ElFormItem>
  </ElFrom>
  <div>{{ yyyy }}</div>
  <ElButton @click="go1">test1</ElButton>
  <h2>
    Post http://localhost:8080/a/b Http Content-Type:application/json
    Content-Length:1110 {"name":"zs",age:11}
  </h2>
</template>
<script lang="ts">
/**
 * 页面核心数据结构体说明文档
 *
 *
 */
// import from

import { defineComponent } from "vue";
import axios from "axios";
export default defineComponent({
  name: "HttpView",
  props: {
    sampleP: {
      type: Number,
      default: 0,
    },
  },
  data() {
    return {
      sampleD: "value",
      //   List<Object>,
      yyyy: {
        name: "xxx",
        age: 11,
      },
      xxxxx: [
        {
          date: "2016-05-03",
          name: "Tom",
          address: "No. 189, Grove St, Los Angeles",
        },
        {
          date: "2016-05-02",
          name: "Toms",
          address: "No. 189, Grove St, Los Angeles",
        },
        {
          date: "2016-05-04",
          name: "Tomsss",
          address: "No. 189, Grove St, Los Angeles",
        },
        {
          date: "2016-05-01",
          name: "Tomsss",
          address: "No. 189, Grove St, Los Angeles",
        },
      ],
    };
  },
  computed: {
    /* sampleC() {
      return this.sampleD + "--";
    }, */
  },
  created() {},
  mounted() {},
  methods: {
    // sampleM() {},
    async go1() {
      console.log("xxxx");

      const res = await axios({
        method: "get",
        url: "http://localhost:8080/test1",
      });
      console.log(res);
    },
    async go2() {
      const res = await axios({

        method: "post",
        url: "http://localhost:8080/test10",
        data: this.yyyy,
      });
    },
    // http xieyi
    // zhangsan 177 176
    // ["zhangsan",177,176]
    // {name:"zhangsan",height:177,weight:176}  21 => json
    // name=zhangsan&height=177&weight=176  20  => www form urlencoding
  },
  watch: {
    // sampleP(n, o) {},
  },
});
</script>

<!--<style scoped>-->
<style lang="scss" scoped></style>
